package com.cf.consumer.controller;

import com.cf.log.DcService;
import com.cf.log.TcService;
import com.google.common.collect.Maps;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * boot-cloud-ApiController
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/7/23 下午 03:04
 */
@RefreshScope
@RestController
public class ApiController {

    @Value("${test} ")
    private String aa;

    @Autowired
    private DcService dcService;

    @Autowired
    private TcService tcService;

    @RequestMapping("/aa")
    public String aa(){
        return aa;
    }

    @RequestMapping("/dc")
    public String dc() throws Exception {
        HashMap<Object, Object> objectObjectHashMap = Maps.newHashMap();
        objectObjectHashMap.put("1", "1");
        return dcService.consumer(objectObjectHashMap);
    }

    @RequestMapping("/tc")
    public String tc() throws Exception {
        HashMap<Object, Object> objectObjectHashMap = Maps.newHashMap();
        objectObjectHashMap.put("1", "1");
        return tcService.tc(objectObjectHashMap);
    }
}
